package com.yjhb.android.sbz.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.entity.RedPackDetails;
import com.jojo.android.zxlib.base.BaseRecyclerAdapter;
import com.jojo.android.zxlib.view.CircleImageView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 创建者 zx
 * 创建时间 2021/1/4 9:57
 */
public class EverydayMoneyAdapter extends BaseRecyclerAdapter<EverydayMoneyAdapter.EverydayHolder, RedPackDetails> {
    private final String TAG = "EverydayMoneyAdapter";


    public EverydayMoneyAdapter(Context context) {
        super(context);
    }

    @Override
    protected EverydayHolder getHolder(View v) {
        return new EverydayHolder(v);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_everyday_money;
    }

    @Override
    public void onBindViewHolder(@NonNull EverydayHolder holder, int position) {
        Glide.with(context).load(entity.getAvatar()).into(holder.headIv);
        holder.nicknameTv.setText(entity.getNickName());
        holder.moneyTv.setText("￥" + entity.getTotalMoney() + "元");
        holder.titleTv.setText(entity.getTitle());
        holder.depictTv.setText(entity.getTaskTitle());
    }


    class EverydayHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.head_iv)
        CircleImageView headIv;
        @BindView(R.id.nickname_tv)
        TextView nicknameTv;
        @BindView(R.id.title_tv)
        TextView titleTv;
        @BindView(R.id.money_tv)
        TextView moneyTv;
        @BindView(R.id.depict_tv)
        TextView depictTv;

        public EverydayHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

}
